package simulator.entities;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;

import javax.imageio.ImageIO;

import simulator.drawengine.DrawEngine;
import simulator.enums.EntityType;
import simulator.types.Lane;

public class Bike extends BaseVehicle
{
//	private BufferedImage imgBike;
	public Bike(TrafficLane spawn, TrafficLane dest)
	{
		super(spawn, dest);
		_checkFarLoop = false;

		_maxSpeed = 6; // 10 units/sec
		_vehicleAcceleration = 3.5f;
		_brakePower = 10;
		_vehicleLength = 1;
		
//		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
//		InputStream input = classLoader.getResourceAsStream("bicycle1.png");
//		try
//		{
//			imgBike = ImageIO.read(input);
//		} catch (IOException e)
//		{
//			e.printStackTrace();
//			System.exit(0);
//		}
	}

	@Override
	public EntityType getType()
	{
		return EntityType.BIKE;
	}

	@Override
	public void draw(Graphics g)
	{
		// TODO Auto-generated method stub

		// _position positie van voertuig
		// _heading richting van voertuig (radian)
		
//		AffineTransform tx = new AffineTransform();
//		tx.rotate(_heading, imgBike.getWidth() / 2, imgBike.getHeight() / 2);
//
//		AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
//		imgBike = op.filter(imgBike, null);
		
		int gfxX = DrawEngine.getGraphicsX(_position.x);
		int gfxY = DrawEngine.getGraphicsY(_position.y);
		g.setColor(Color.cyan);
		g.fillOval(gfxX - 7, gfxY - 7, 15, 15);
//		g.drawImage(imgBike, gfxX, gfxY, 22, 35, null);
	}
}
